package edu.pku.sei.act.capabilityprovider;

import edu.pku.sei.act.actools.ICapabilityManager;
import edu.pku.sei.act.actools.ICapabilityProvider;
import edu.pku.sei.act.actools.IEnvEntry;
import edu.pku.sei.act.actools.util.ACToolsNamingSpace;
import android.os.Bundle;
import android.os.IBinder;
import android.app.Activity;
import android.content.ComponentName;
import android.content.ServiceConnection;
import android.view.Menu;
import android.widget.Button;

public class CapabilityProvider extends Activity {
	
	private static ICapabilityManager CapabilityManager;
	private static IEnvEntry EnvEntry;
	private static ICapabilityProvider provider;
	
	public static ICapabilityManager getCapabilityManager() {
		return CapabilityManager;
	}

	public static IEnvEntry getEnvEntry() {
		return EnvEntry;
	}

	private ServiceConnection CMConnection = new ServiceConnection() {

		public void onServiceConnected(ComponentName arg0, IBinder arg1) {
			
			CapabilityManager = ICapabilityManager.Stub.asInterface(arg1);
		}

		public void onServiceDisconnected(ComponentName name) {
			
			CapabilityManager = null;
		}
	};
	
	private ServiceConnection EEConnection = new ServiceConnection() {

		public void onServiceConnected(ComponentName arg0, IBinder arg1) {
			
			EnvEntry = IEnvEntry.Stub.asInterface(arg1);
		}

		public void onServiceDisconnected(ComponentName name) {
			
			EnvEntry = null;
		}
	};

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_capability_provider);
        
        Button regist = (Button)findViewById(R.id.regist_on_cm);
        
        Button add = (Button)findViewById(R.id.button1);

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_capability_provider, menu);
        return true;
    }
}
